package UnitTest.AlgorithmTest.dynamicTest.PalindromeTest;

import Algorithm.dynamic.palindrome.*;
import org.junit.Test;

/**
 * @author liujun
 * @version 1.0
 * @date 2019-11-07 22:41
 * @author-Email ljfirst@mail.ustc.edu.cn
 * @description 回文串判断
 */
public class FindPalindromeTest {

    @Test
    public void TestFindPalindromeByPoint() {
        test(new FindPalindromeByPoint());
    }

    @Test
    public void TestFindPalindromeOps() {
        test(new FindPalindromeOps());
    }

    @Test
    public void TestFindPalindrome() {
        test(new FindPalindrome());
    }

    @Test
    public void TestFindPalindromeViolence() {
        test(new FindPalindromeViolence());
    }


    public void test(Palindrome palindrome) {
        String target = palindrome.FindPalindrome(TestString01);
        assert target == null;
        target = palindrome.FindPalindrome(TestString02);
        assert target == null;
        target = palindrome.FindPalindrome(TestString03);
        assert target.equals(TestString03Answer);
        target = palindrome.FindPalindrome(TestString04);
        assert target.equals(TestString04Answer);
        target = palindrome.FindPalindrome(TestString05);
        assert target.equals(TestString05Answer);
        target = palindrome.FindPalindrome(TestString06);
        assert target.equals(TestString06Answer);
        target = palindrome.FindPalindrome(TestString07);
        assert target.equals(TestString07Answer);
        target = palindrome.FindPalindrome(TestString08);
        assert target.equals(TestString08Answer);
        target = palindrome.FindPalindrome(TestString09);
        assert target.equals(TestString09Answer);
        target = palindrome.FindPalindrome(TestString10);
        assert target.equals(TestString10Answer);
        target = palindrome.FindPalindrome(TestString11);
        assert target.equals(TestString11Answer);
        target = palindrome.FindPalindrome(TestString12);
        assert target.equals(TestString12Answer);
        target = palindrome.FindPalindrome(TestString13);
        assert target.equals(TestString13Answer);
    }

    String TestString01 = null;
    String TestString02 = "";
    String TestString03 = "abcddcba";
    String TestString03Answer = "abcddcba";
    String TestString04 = "abcdcba";
    String TestString04Answer = "abcdcba";
    String TestString05 = "sdfabcdcba";
    String TestString05Answer = "sdfabcdcba";
    String TestString06 = "abcdcbawer";
    String TestString06Answer = "abcdcbawer";
    String TestString07 = "dec4evp5v8eswnrtbutymnabcdcbaymabcdicbarfvbgtcjvp9vc";
    String TestString07Answer = "dec4evp5v8eswnrtbutymnabcdcbaymabcdicbarfvbgtcjvp9vc";
    String TestString08 = "awhnjkwhcwnlkibectdvhewhcoicybua";
    String TestString08Answer = "";
    String TestString09 = "a";
    String TestString09Answer = "a";
    String TestString10 = "abb";
    String TestString10Answer = "bb";
    String TestString11 = "acaccccccccccc";
    String TestString11Answer = "ccccccccccc";
    String TestString12 = "babad";
    String TestString12Answer = "bab";
    String TestString13 = "cbbd";
    String TestString13Answer = "bb";

}